# app/repositories/sponsors_repo.py
from sqlalchemy import func, case
from sqlalchemy.orm import Session
from app.models.iaro_coop_admin.sponsor import (
    Sponsor, SponsorContact,Sponsorship, SponsorshipPlaces
)
from app.models.iaro_coop_admin.program import Program
import re
from datetime import datetime

class SponsorsRepo:
    def __init__(self, db: Session):
        self.db = db

    def get_sponsor_by_id(self, sponsor_id: int) -> Sponsor:
        return self.db.query(Sponsor).filter(Sponsor.sponsor_id == sponsor_id).first()

    def get_sponsor_contacts(self, sponsor_id: int) -> list[SponsorContact]:
        return self.db.query(SponsorContact).filter(SponsorContact.sponsor_id == sponsor_id).all()

    def get_sponsorships(self, sponsor_id: int) -> list[Sponsorship]:
        return self.db.query(Sponsorship).filter(Sponsorship.sponsor_id == sponsor_id).all()
    